﻿<html>
<title> Bài 5</title>
<FORM METHOD = POST ACTION="#">	

<center><h1><b><font color="blue" size=20>Bài 5 <hr width =30%></font></h1></u>
      <br>
   <b><i><font color= "blue"> Toán:</font></i></b>
   <INPUT  TYPE= "char" NAME ="a" SIZE="4">
   <b><i><font color= "blue"> Lý:</font></i></b>
   <INPUT  TYPE= "char" NAME ="b" SIZE="4">
   <b><i><font color= "blue"> Hóa:</font></i></b>
   <INPUT  TYPE= "char" NAME ="c" SIZE="4">
      <br><br>
   <input type="image" height= 50 src="ok.jpg" value="linh" name="ok"  />
   <input type="image" height= 50 src="xoa.jpg" value ="linh" name ="delete"/>

   <font color="blue" size="30">
   <br><br>
 <hr width =50%>
 <?php global $a,$b,$c,$TB ;
 if(isset($_POST["a"])&&isset($_POST["b"])&&isset($_POST["c"]))
 {
 $a=$_POST["a"]; $b=$_POST["b"]; $c=$_POST["c"];
 if($a==null && $b==null && $c==null)
    { echo "Null!";
	  return;
	}
  if($a>10 or $b>10 or $c>10)
    { echo "Error!";
      return;
    } 
	$k=ctype_digit($a);
	$h=ctype_digit($b);
	$s=ctype_digit($c);
  if($k!=1 or $h!=1 or $s!=1)
	{ 
      echo "Not digit";
	  return;
	}
 }
 
 ?>
 <TABLE BORDER >
     <TR> <TH COLSPAN=7><font color=blue size 30><b>BẢNG KẾT QUẢ</font></TH><BR></TR>
        <TR>
            <TD><CENTER><b> Toán</CENTER></TD><TD><CENTER><b>Lý</CENTER></TD>
            <TD><CENTER><b>Hóa</CENTER></TD><TD><CENTER><b>Tổng Điểm</CENTER></TD><TD><CENTER><b>DTB</CENTER></TD>
            <TD><CENTER><b>Kết Quả</CENTER></TD><TD><CENTER><b>Xếp Loại</CENTER></TD>
        </TR>
        <TR>
            <TD width=100><CENTER>
		      <?php	
            	if(isset($_POST["a"]))
                 {  
                  $a=$_POST["a"];
                  echo $a;
                 }	
              ?></CENTER>
          </TD>
		  <TD width=100 height=30><CENTER>
		     <?php	
				if(isset($_POST["b"]))
				{  
				  $b=$_POST["b"];
				  echo $b;
			    }	
			  ?></CENTER>
		 </TD>
		  <TD width=100><CENTER>
		     <?php	
				if(isset($_POST["c"]))
				{  
				  $c=$_POST["c"];
				  echo $c;
				}	
			   ?></CENTER>
		 </TD>
		  <TD width=100><CENTER>
			 <?php
			     
				$T=($a+$b+$c);
				echo $T;
 
			  ?></CENTER>
		 </TD>
		  <TD width=100><CENTER>
			 <?php
			     //$TB="";
				$TB=round(($a+$b+$c)/3,2);
				echo $TB;
 
			  ?></CENTER>
		 </TD>
		  <TD width=100><CENTER>
		    <?php	
			$t=$a+$b+$c;
			if($t>15 or $t==15)
			  { echo "Đậu";}
			if($t<15) {echo "Rớt";}
		      ?></CENTER>
		 </TD>
		  <TD width=10O><CENTER>
		     <?php
			if($TB>=8)
			 { echo "GIỎI";}
			if($TB<8 AND $TB>=6.5)
			 { echo "KHÁ";}
		    if($TB<6.5 AND $TB>=5) {echo "TB";}
		     ?></CENTER> 
		  </TD>
</TABLE>
</html>